package com.kebaijia.bio;

import java.io.*;
import java.net.Socket;

/**
 * @author luoy
 * @date 2018/7/23 0023 下午 5:24
 * @Description: ${todo}
 */
public class BioClient {

    public static void main(String[] args) throws IOException {

        for (int i = 0; i <1000 ; i++) {

            //客户端对象
            Socket socket = new Socket("localhost",8989);

            OutputStream outputStream = socket.getOutputStream();
            DataOutputStream dataOutputStream = new DataOutputStream(outputStream);
            dataOutputStream.writeUTF("yangji");
            socket.shutdownOutput();


            InputStream inputStream = socket.getInputStream();
            DataInputStream dataInputStream = new DataInputStream(inputStream);
            String s = dataInputStream.readUTF();
            socket.shutdownInput();
            System.out.println(s);
        }
    }
}
